﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;


public delegate IHttpModule CreateDynamicHttpModule(  );


public static class DynamicHttpModuleManager
{
    private static List<CreateDynamicHttpModule> _createModuleHandlerList 
        = new List<CreateDynamicHttpModule>();

    public static void RegisterDynamicModule(CreateDynamicHttpModule handler )
    {
        _createModuleHandlerList.Add(handler);
    }

    public static List<IHttpModule> GetModules()
    {
        List<IHttpModule> list = new List<IHttpModule>();
        foreach (CreateDynamicHttpModule handler in _createModuleHandlerList)
        {
            IHttpModule module = handler();
            list.Add(module);
        }
        return list;
    }
}